/*****************************************************************
 * $ Id : constant.h    2011/08/01
 * 
 * swhors@naver.com
 *****************************************************************/

/*****************************************************************
 * 2011/08/24  15:57:00 : Some definition is moved from  skylistener.cpp
 * 2011/08/25  10:05:00 : All definition is moved with excepting db.
 *
 *****************************************************************/

#pragma once

/*****************************************************************
 * constant definition
 *****************************************************************/

#define ACD_LIST_FOLDER	      "/var/spool/asterisk/"
#define ACD_OUTGOING_FOLDER   "/var/spool/asterisk/outgoing/"
#define DEF_RECORD_PATH       "/var/spool/asterisk/recording"

#define	connect_port	5038
#define connect_addr	"localhost"

#define PROG_NAME	 "skylistener"
#define LOCK_FILE	 "/var/run/skylistener.pid"

#define LOG_FILE	"/var/log/skylistener.log"

#ifdef _DEBUG
#define SKYCONF_FILE "./ref/skyconf.ini"
#else
#define SKYCONF_FILE "/etc/skyconf.ini"
#endif

#define WELCOME_TITLE "Asterisk Call Manager"

#define DEFAULT_CHANNAME	"SkyCom"

#define listen_port	5409
#define	connect_port	5038
#define connect_addr	"localhost"

#define ACD_CMD_START          "START"
#define ACD_CMD_STOP           "STOP"
#define ACD_CMD_LOAD           "LOAD"
#define ACD_CMD_RELOAD	       "RELOAD"
#define ACD_CMD_KICKOUT	       "KICKOUT"
#define ACD_CMD_ADDMEMBER      "ADDMEM"
#define ACD_CMD_ADDCUSTOM      "ADDCUS"

#define MAX_RECV_BUFF_SIZE     1024
#define USERNAME_MAX_LEN       64
#define MAX_PATH_LENGTH	       256
#define READ_LINE_BUF_LEN      256
#define	ACD_MEMBER_NAME_LEN    64

/***********************************************************************
 * type definition
 ***********************************************************************/

typedef unsigned char	BYTE;
typedef unsigned char*	PBYTE;
typedef unsigned char	byte;

typedef short	int16_t;
typedef int	int32_t;
typedef unsigned char	uint8_t;
typedef unsigned short	uint16_t;
typedef unsigned int    uint32_t;

typedef enum _command_type
{
    cmd_type_unknown= 0,
    cmd_type_event,
    cmd_type_response,
    cmd_type_hello
}cmd_type;

typedef enum _event_type
{
    cmd_event_unknown = 0,
    cmd_event_conf_join,
    cmd_event_conf_leave,
    cmd_event_conf_state,
    cmd_event_conf_dtmf,
    cmd_event_newcallerid,
    cmd_event_newaccountcode,
    cmd_event_extensionstatus,
    cmd_event_newstate,
    cmd_event_newexten,
    cmd_event_varset,
    cmd_event_rtcpsent,
    cmd_event_hangup,
    cmd_event_newchannel
} event_type;

typedef enum _e_ami_con_state
{
   e_con_false = 0,
   e_con_true
}EAMICONSTATE;

typedef enum _e_proc_state
{
   e_proc_ready = 0,
   e_proc_run
}EPROCSTATE;

typedef enum _e_db_con_state
{
   e_db_con_false = 0,
   e_db_con_true
}EDBCONSTATE;

typedef enum e_return_bval
{
   e_ret_false = 0,
   e_ret_true
}ERETURNVAL;

typedef enum e_socket_type
{
   e_socket_tcp = 0,
   e_socket_udp
}ESOCKETTYPE;

typedef enum e_socket_dir
{
   e_socket_listen = 0,
   e_socket_connect
}ESOCKETDIR;

#define SOCK_ADDR_LEN	25


